package workload

import (
	k8sclient "k8s_gui_client/k8s/client"
)

//deployment list
func GetDeployments(namespace string  ) (map[string]interface{},error){

	if namespace != "" {
	   return  k8sclient.CurrentK8sApiClient.GetAPI("/apis/apps/v1/namespaces/"+namespace+"/deployments")
	} else {
	   return  k8sclient.CurrentK8sApiClient.GetAPI("/apis/apps/v1/deployments")
		
	}
	
	
}

func DeploymentURL(namespace string, name string) string {
	return "/apis/apps/v1/namespaces/" + namespace + "/deployments/" + name
}


func GetDeploymentYaml(namespace string,name string) (string ,error){
    return k8sclient.CurrentK8sApiClient.GetAPIAsYaml(DeploymentURL(namespace,name))
}